abstract class Animal {
  getName() {
    console.log('get Animal Name');
  }

  abstract sleep(): void
}

class Dog extends Animal {
  private name: string;
  readonly author: string = 'ataola';

  constructor(name: string) {
    super();
    this.name = name;
  }

  getName() {
    return this.name;
  }

  private run() {

  }

  protected dance() {

  }

  sleep() {
    console.log(`${this.name} is sleep.`);
  }

  static eat() {
    console.log('eat');
  }
}

class Husky extends Dog {

  constructor(name: string, public color: string) {
    super(name);
    this.color = color;
  }

  getColor() {
    return this.color;
  }
}


class Cat extends Animal {
  private name: string;

  constructor(name: string) {
    super();
    this.name = name;
  }

  getName() {
    return this.name;
  }

  sleep() {
    console.log(`${this.name} is sleep.`);
  }
}


let dog = new Dog('dahuang');
let cat = new Cat('tom');
let husky = new Husky('哈士奇', 'red');
console.log(husky.getColor());
let animals: Animal[] = [dog, cat];
animals.forEach(animal => {
  console.log(animal.getName());
  animal.sleep();
});


